<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.2.3/css/bootstrap.css" rel="stylesheet">
    <style>
        .preview {
            margin: 0 auto;
        }
        .image {
            width: 300px;
        }
        .path, .new_path {
            max-width: 200px;
            word-break: break-all;
            text-decoration: underline;
            color: #2169eb;
            cursor: pointer;
        }
        .curl {
            width: 300px;
        }
    </style>
    <title>页面回流截图</title>
</head>
<body>
<table class="preview table table-dark" border="1">
    <thead>
    <tr>
        <th>页面标题</th>
        <th>城市版截图</th>
        <th>全国版截图</th>
        <th>原路径</th>
        <th>新路径</th>
        <th>curl</th>
    </tr>
    </thead>
    <tbody>
    <% list.forEach((item,index) => { %>
    <tr>
        <td><%= item.title %></td>
        <td>
            <img class="image" src="<%= item.old %>" alt="">
        </td>
        <td>
            <img class="image" src="<%= item.new %>" alt="">
        </td>
        <td>
            <p class="path"><%= item.old_path %></p>
        </td>
        <td>
            <p class="new_path"><%= item.new_path %></p>
        </td>
        <td>
            <textarea class="form-control" aria-label="With textarea" rows="12" type="text" class="curl"><%= item.curl %></textarea>
        </td>
    </tr>
    <% }) %>
    </tbody>
</table>

</body>
<script>
    function copy(str) {
        const oInput = document.createElement('input');
        oInput.value = str;
        document.body.appendChild(oInput);
        oInput.select();
        document.execCommand('Copy');
        oInput.remove();
    }
    const linkDom = document.querySelector(".path")
    linkDom.addEventListener('click', e => {
        copy(e.target.innerText)
    })
    const linkDom2 = document.querySelector(".new_path")
    linkDom2.addEventListener('click', e => {
        debugger
        copy(e.target.innerText)
    })
</script>
</html>
